package com.hll.erp.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hll.erp.dao.SellDao;
import com.hll.erp.entity.Sell;
import com.hll.erp.service.SellService;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * (Sell)表服务实现类
 *
 * @author makejava
 * @since 2021-07-04 15:18:01
 */
@Service
public class SellServiceImpl extends ServiceImpl<SellDao, Sell> implements SellService {
  @Override
  public Page<Sell> getSells(Integer current, Integer pageSize, Date start, Date end) {
    Page<Sell> page = new Page<>(current, pageSize);
    QueryWrapper<Sell> sellQueryWrapper = new QueryWrapper<>();
    if (start != null) sellQueryWrapper.ge("sell_date", start);
    if (end != null) sellQueryWrapper.le("sell_date", end);
    page = this.page(page, sellQueryWrapper);
    return page;
  }
}
